package com.yl.module.base.model;

import com.alibaba.fastjson.JSONObject;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;

/**
 * 返回JSON数据
 * @Author jiangtao
 * @CreateBy 2018-12-28 1:11 PM
 * @Version v1.0
 */
@Data
@Builder
public class R<T> implements Serializable {

    private int code;

    private String message;

    private String redirectUrl;

    private T data;

    /**
     * 输出json
     * @return
     */
    public String echo() {
        return toString();
    }

    @Override
    public String toString() {
        return JSONObject.toJSONStringWithDateFormat(this, "yyyy-MM-dd HH:mm:ss");
    }

}
